<!--
 * @Author: wjk
 * @Date: 2019-12-31 15:40:51
 * @LastEditors: wjk
 * @LastEditTime: 2020-11-26 15:03:10
 * @description: file content
 -->
<template>
  <base-page-view class-name="page-container mine-invited" :show-to-top="false">
    <share v-if="showShareDia" :share-option="shareOption" still-show need-h5 @showChange="setMsg"></share>
    <!-- <view v-if="showMsg" class="lookInvited" @click="$navigateTo('/pagesMine/invited/myInvited')"><text>温馨提示: 邀请我的好友这里</text> <text>查看</text></view> -->
  </base-page-view>
</template>

<script>
import { mapGetters } from 'vuex'
import { queryShareOption } from '@/utils/tools'
import share from '@/components/draw/share'
import './index.scss'
export default {
  components: {
    share
  },
  data() {
    return {
      shareBg: `${process.env.VUE_APP_IMAGE_ASSET}/images/share/`,
      shareOption: {}, // 分享自定义设置
      val: '',
      showMsg: true,
      showShareDia: false,
      filePath: '',
      icon: '/static/images/app_logo.png'
    }
  },
  computed: {
    ...mapGetters([
      'userToken',
      'user',
      'setting'
    ])
  },
  onLoad() {
    // #ifdef MP-WEIXIN
    // #endif
  },
  onShow() {
    // #ifdef H5
    // #endif
  },
  onShareAppMessage(res) {
    return queryShareOption(res, this.shareOption)
  },
  methods: {
    // 分享初始化
    initShare() {
      if (!this.userToken) {
        this.hideShare()
        return
      }
      this.shareOption.share_route = `/pagesOther/register/index?inviteCode=${this.user.invite_code}`
      this.shareOption.share_url = `/pagesOther/register/index?inviteCode=${this.user.invite_code}`
      // #ifdef MP-WEIXIN
      this.shareOption.share_url = `${process.env.VUE_APP_PRE_URL}/pagesOther/register/index?inviteCode=${this.user.invite_code}`
      // #endif
      this.shareOption.type = 'simple'
      this.shareOption.share_list = [{
          pic: this.shareBg + 'share_01.jpg',
          titleArr: [
            '选择，大于努力',
            '加入碧选',
            '自购分享多赚一点'
          ]
        },
        {
          pic: this.shareBg + 'share_02.jpg',
          titleArr: [
            '选择，大于努力',
            '加入碧选',
            '自购分享多赚一点'
          ]
        },
        {
          pic: this.shareBg + 'share_03.jpg',
          titleArr: [
            '选择，大于努力',
            '加入碧选',
            '自购分享多赚一点'
          ]
        }
      ]
      this.showShare()
      this.showShareDia = true
    },
    setMsg(e) {
      console.log('e', e)
      this.showMsg = !e
    }
  }
}
</script>
